﻿using SqlSugar;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using WORKALERT;
using static WORKALERT.MgncPager;

namespace BaseFrame
{
    public class BaseForm : DevExpress.XtraEditors.XtraForm
    {
        protected int _curPage = 1;
        protected int _pageSize = 25;
        protected int _allcount = 0;
        protected bool isInitPage = false;
        protected List<IConditionalModel> _conModels = new List<IConditionalModel>();
        /// <summary>
        /// 在容器控件中添加分页控件
        /// </summary>
        /// <param name="pageParentControl">填充分页控件的容器</param>
        /// <param name="GridView">数据显示容器</param>
        /// <param name="myPagerEvents">分页事件</param>
        protected void AddPageUserControl(Control pageParentControl, DevExpress.XtraGrid.Views.Grid.GridView gridView1 , DevExpress.XtraGrid.GridControl gridControl1, MyPagerEvents myPagerEvents)
        {
            var _mgnc = new MgncPager(gridView1, gridControl1);
            pageParentControl.Controls.Add(_mgnc);
            _mgnc.Dock = DockStyle.Fill;
            _mgnc.myPagerEvents += myPagerEvents;//分页事件
            myPagerEvents(_curPage, _pageSize,_mgnc);//默认执行一次分页
        }

    }
}
